<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class Jobs extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		//
		Schema::create("jobs", function($table)
		{
			// indentifiers
			$table->increments("id");

			// decriptors
			$table->string("title");
			$table->string("slug");
			$table->integer("jobtypeid");
			$table->string("position");
			$table->string("location");
			$table->string("salary");
			$table->text("description");

			// soft deletes
			$table->softDeletes();

			// timestamps
			$table->timestamps();
		});

		Schema::create("job_types", function($table)
		{
			$table->increments("id");
			$table->text("jobtype");

			// soft deletes
			$table->softDeletes();

			// timestamps
			$table->timestamps();
		});

		Schema::create("job_files", function($table)
		{
			$table->increments("id");
			$table->text("filename");

			// soft deletes
			$table->softDeletes();

			// timestamps
			$table->timestamps();
		});
		//
		Schema::create("job_job_files", function($table)
		{
			$table->increments("id");
			$table->integer("jobid");
			$table->integer("fileid");

			// soft deletes
			$table->softDeletes();

			// timestamps
			$table->timestamps();
		});

		DB::table('job_types')->insert(array(
			array('jobtype' => 'Contract'),
			array('jobtype' => 'Full-time'),
			array('jobtype' => 'Part-time'),
			array('jobtype' => 'Casual')
		));
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		//
		Schema::drop("jobs");
		Schema::drop("job_types");
		Schema::drop("job_files");
		Schema::drop("job_job_files");
	}

}
